#ifndef SHIPPOOL_H
#define SHIPPOOL_H

#include <QObject>
#include <list>
#include <mutex>
#include "ship.h"

// 船只池
class ShipPool : public QObject
{
    Q_OBJECT
    SINGLETON(ShipPool)
    QML_READONLY_PROPERTY(QStringList, shipList, ShipList)
    QML_READONLY_PROPERTY(QStringList, loadedShipList, LoadedShipList)
public:
    explicit ShipPool(QObject *parent = nullptr);

    void passShip(const QString front_ship);

signals:

public slots:
    void fillShip();

    void onShipTransportAway(const Ship* ship);

private:
    QStringList getNewShipList(std::list<std::shared_ptr<Ship>>& ship_pool);
    std::list<std::shared_ptr<Ship>> m_ship_pool;
    std::list<std::shared_ptr<Ship>> m_loaded_ship_pool;
    std::mutex m_pool_mtx;
};

#endif // SHIPPOOL_H
